﻿using Commons.ReturnData;
using Microsoft.AspNetCore.Mvc;
using OpenAI.Domain.Entities;
using OpenAI.Infrastructure.Requests;
using OpenAI.Infrastructure.Services;

namespace OpenAI.WebAPI.Controllers
{
    [ApiController]
    [Area("ChatTip")]
    [Route("[area]/[controller]/[action]")]
    public class ChatTipController:ControllerBase
    {
        private readonly ChatTipService chatTipService;
        public Guid AppUserId { get; set; }

        public ChatTipController(ChatTipService chatTipService)
        {
            this.chatTipService = chatTipService;
        }

        [HttpGet]
        public async Task<DataResult<ChatTip>> GetChatTipsAsync()
        {
            return await chatTipService.GetChatTipsAsync(AppUserId);
        }
        [HttpPost]
        public async Task<SingleResult> CreateTipAsync(CreateChatTipRequest request)
        {
            return await chatTipService.CreateTipAsync(request);
        }

        [HttpPost]
        public async Task<SingleResult> UpdateTipAsync(UpdateChatTipRequest request)
        {
            return await chatTipService.UpdateTipAsync(request);
        }

        [HttpDelete]
        public async Task<SingleResult> DeleteTipAsync(int id)
        {
            return await chatTipService.DeletedTipByIdAsync(id);
        }







        
    }
}
